//引入util js
var _util = require('util/util.js');

//statics-service
var _statics_service = {
    getdayincome : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/day/income"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getweekincome : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/week/income"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getmonthincome : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/month/income"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getyearincome : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/year/income"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getusernum : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/users"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getshopnum : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/shops"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getitemnum : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/items"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getsellernum : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/sellers"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getyearrefund : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/year/refund"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getweekrefund : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/week/refund"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getweekreorders : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/week/orders"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getyearreorders : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/year/orders"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getcategorysellnum : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/year/categorysellnum"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getshopsellnum : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/year/shopsellnum"),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getallbrowsingrecords : function(pagesize,pageid,resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/browsingrecords/pages/"+pagesize+"/"+pageid),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
    getbrowsingrecordsby : function(username,time,pagesize,pageid,resolve,reject){
        _util.request({
            url     : _util.getServerURL("/admin/statistics/username/"+username+"/time/"+time+"/browsingrecords/pages/"+pagesize+"/"+pageid),
            method  : 'GET',
            success : resolve,
            error   : reject,
        });
    },
}

module.exports = _statics_service;